<||= importPartial "components/head.html" ||>
    <body data-prismjs-copy-timeout="500">
        
    <||= importPartial "components/navbar.html" ||>
        
        <main>
            <div class="columns doccols">
                <!-- SIDEBAR -->
                <||= importPartial "components/sidebar.html" ||>

                <!-- MAIN -->
                <div class="column is-9 p-6 mb-6">

                    <!-- Breadcrumbs -->
                    <||= importPartial "components/breadcrumbs.html" ||>
                    
                    <!-- Title -->
                    <div class="level mt-6 is-mobile">
                        <div class="level-left">
                            <h2 class="level-item title is-size-3-touch is-size-2"><||= W\name ||></h2>
                        </div>
                        <||= if key? W 'alias [||>
                            <div class="level-right">
                                <h2 class="level-item title is-size-3-touch is-size-2">
                                    <pre class="pt-0 pb-0 is-success"><||=W\alias||></pre>
                                </h2>
                            </div>
                        <||]||>
                    </div>
                    
                    <!-- Description -->
                    <h3 class="subtitle is-4 is-spaced"><||=W\description ||></h3>
                    
                    <hr>

                    <|| if W\type = :function [ ||>
                        <!-- Parameters -->
                        <h4 class="title is-size-6-touch is-size-5 is-spaced mt-6">Parameters</h4>
                        <pre class="is-size-7-touch is-size-6"><b><||=W\name||></b> <||= 
                            funcParams: new [] 
                            loop W\arguments [k,v] [ 
                                funcParam: new ~"<ins>|k|</ins> " 
                                'funcParam ++ join.with:" " map v 'vv [":" ++ (to :string vv)] 
                                'funcParams ++ funcParam
                            ] 
                            join.with:"\n"++repeat " " (size W\name)+1 funcParams
                        ||></pre>

                        <!-- Attributes -->
                        <||= if not? empty? W\attributes [||>
                            <h4 class="title is-size-6-touch is-size-5 is-spaced mt-6">Attributes</h4>
                            
                            <table class="table is-stripped is-hoverable is-fullwidth">
                                <||= loop W\attributes [k,v][
                                    types: join.with: ", " map filter v\types 'tp [tp = :logical] 'tp ["<i>:" ++ (to :string tp) ++ "</i>"]
                                ||>
                                    <tr>
                                        <td><span class="semibold"><||= k ||></span></td>
                                        <td><||= types ||></td>
                                        <td><||= v\description ||></td>
                                    </tr>
                                <||]||>
                            </tbody></table>
                        <||]||>
                    <|| ] ||>

                    <!-- Returns -->
                    <h4 class="title is-size-6-touch is-size-5 is-spaced mt-6">Returns</h4>

                    <div class="content">
                        <ul>
                        
                            <|| loop W\returns 'ret [||>
                                <li><||= (ret=:nothing)? -> "or &nbsp;" -> "" ||><em>:<||= ret ||></em></li>
                            <||]||>
                        </ul>
                    </div>

                    <|| if and? [W\type = :function] [not? empty? W\examples] [ ||>
                        <!-- Examples -->
                        <h4 class="title is-size-6-touch is-size-5 is-spaced mt-6">Examples</h4>

                        <|| loop W\examples 'example [||>
                            <pre class="is-size-7-touch is-size-6"><div class="copy">copy</div><code class="language-arturo"><||= example ||></code></pre>
                            <||= if example <> last W\examples [||><br><|| ] ||>
                        <|| ] ||>
                    <|| ] ||>

                    <!-- Related -->
                    <h4 class="title is-size-6-touch is-size-5 is-spaced mt-6">Related</h4>
                    
                    <div class="content">
                        <ul class="list">
                            <||= loop W\related 'rel [||>
                                <li class="list-item"><a href="<||= linkTo ~{documentation/library/|lower rel|} ||>"><||= replace rel "/" " / " ||></a></li>
                            <||]||>
                        </ul>
                    </div>

                </div>
            </div>
        </main>

<||= importPartial "components/foot.html" ||>